package com.nbsaas.boot.agent.rest.resource;

import com.nbsaas.boot.agent.api.apis.AgentApi;
import com.nbsaas.boot.entity.agent.Agent;
import com.nbsaas.boot.agent.api.domain.request.AgentRequest;
import com.nbsaas.boot.agent.api.domain.response.AgentResponse;
import com.nbsaas.boot.agent.api.domain.simple.AgentSimple;
import com.nbsaas.boot.agent.rest.convert.AgentSimpleConvert;
import com.nbsaas.boot.agent.rest.convert.AgentEntityConvert;
import com.nbsaas.boot.agent.rest.convert.AgentResponseConvert;
import com.nbsaas.boot.agent.data.repository.AgentRepository;

import java.io.Serializable;
import com.nbsaas.boot.jpa.data.core.BaseResource;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import jakarta.annotation.Resource;
import org.springframework.data.jpa.repository.support.JpaRepositoryImplementation;

import java.util.function.Function;
/**
*   -业务接口实现
*/
@Transactional
@Service
public class AgentResource extends BaseResource<Agent,AgentResponse, AgentSimple, AgentRequest>  implements AgentApi {

    @Resource
    private AgentRepository agentRepository;

    @Override
    public JpaRepositoryImplementation<Agent, Serializable> getJpaRepository() {
        return agentRepository;
    }

    @Override
    public Function<Agent, AgentSimple> getConvertSimple() {
        return new AgentSimpleConvert();
    }

    @Override
    public Function<AgentRequest, Agent> getConvertForm() {
        return new AgentEntityConvert();
    }

    @Override
    public Function<Agent, AgentResponse> getConvertResponse() {
        return new AgentResponseConvert();
    }




}


